package eoeProject.edenOfEast.page.analyses.analysesRes.component;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;

import eoeProject.edenOfEast.bean.EOEAnalysesBean;
import eoeProject.edenOfEast.core.EOEAuthenticatedWebSession;
import eoeProject.edenOfEast.utils.AnalysesUtils;

//@AuthorizeInstantiation("ADMIN")
public class AnalysesResPanel extends Panel {
	private static final long serialVersionUID = 1L;

	private EOEAnalysesBean analyses;

	public AnalysesResPanel(String id, Integer analysesId) {
		super(id);

		analyses = AnalysesUtils.getAnalysesBean(analysesId);
		add(new Label("analysesTitle", "分析＞" + analyses.getTitle()));
		AnalysesResDetailPanel analysesResdetailPanel = new AnalysesResDetailPanel(
				"analysesResDetailPanel", analyses);
		AnalysesResEditInputPanel analysesResEditPanel = new AnalysesResEditInputPanel(
				"analysesResEditPanel", analyses, false, analysesId);
		AnalysesResFormPanel analysesResFormPanel = new AnalysesResFormPanel(
				"analysesResFormPanel", analyses.getAnalysesId());
		AnalysesResListPanel analysesResListPanel = new AnalysesResListPanel(
				"analysesResListPanel", analyses);

		if (analyses.getCreateUserId() == EOEAuthenticatedWebSession
				.getUserId())
			analysesResEditPanel.setVisible(true);
		else
			analysesResEditPanel.setVisible(false);
		analysesResEditPanel.setOutputMarkupId(true);
		add(analysesResEditPanel);
		analysesResdetailPanel.setOutputMarkupId(true);
		add(analysesResdetailPanel);
		analysesResFormPanel.setOutputMarkupId(true);
		add(analysesResFormPanel);
		analysesResListPanel.setOutputMarkupId(true);
		add(analysesResListPanel);

	}
}
